<%@page import="com.kaishengit.entity.User"%>
<%@page import="com.kaishengit.entity.Prod"%>
<%@page import="com.kaishengit.dao.ProdDao"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
     <title>My JSP 'index.jsp' starting page</title>
 </head>
  <body>
  
  <%@include file="daohang.jsp" %>
  
    <%
    	User user=(User)session.getAttribute("user");
    	
        ProdDao dao=new ProdDao();
		List<Prod> prodList=dao.findAll();
		request.setAttribute("prodList", prodList);
%>
  <table border="1px" width="70%">
   		<tr>
   			<th>商品名称</th>
	   		<th>商品价格</th>
	   		<th>操作</th>
   		</tr>
    <%
   		for(Prod p:prodList){
   	 %>
   	 <tr> 
   	 		<td><%=p.getProdName()%></td>
   	 		<td><%=p.getPrice()%></td>
   	 		<td>
   	 			<a href="prod.jspx?m=edit&id=<%=p.getId()%>">修改</a>
   	 			<a href="prod.jspx?m=del&id=<%=p.getId()%>">删除</a>
   	 			
   	 		</td>
   	 		<%}%>
   	 </tr>
   </table>
   <br/>
   <a href="prod.jspx?m=add">添加新商品</a>
  </body>
</html>
